<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Hello world!</title>
    <!-- zui -->
    <link href="static/css/zui.min.css" rel="stylesheet">
    <link href="static/css/zui-theme.css" rel="stylesheet">
    <link href="static/lib/bootbox/bootbox.min.css" rel="stylesheet">
</head>
<body>
<?php include __DIR__.'/nav.tpl.php'?>
<!-- 在此处编码你的创意 -->
<div class="code-wrap">

        <?php
            $file = self::$file ;
            $size = filesize($file) / 1024 / 1024 ;
            if($size > 2 ){
                echo "<small class=\"with-padding bg-success\">总大小:{$size}MB,读取文件末尾1000行</small>" ;
                $content =  `tail -n 1000 $file | cat -n` ;
            }else{
                $line = `cat $file | wc -l` ;
                if($line > 1000){
                    echo "<small class=\"with-padding bg-success\">总行数:{$line},读取文件末尾1000行</small>" ;
                    $content =  `tail -n 1000 $file | cat -n` ;
                }else{
                    $content =  `cat -n $file` ;
                }
            }



        ?>
    <textarea class="form-control" style="height: 100%">
        <?=$content?>
    </textarea>
</div>








<!-- jQuery (ZUI中的Javascript组件依赖于jQuery) -->
<script src="static/js/jquery-1.11.0.min.js"></script>
<!-- ZUI Javascript组件 -->
<script src="static/js/zui.min.js"></script>
<script src="static/lib/prettify/prettify.js"></script>
<script src="static/lib/bootbox/bootbox.min.js"></script>
<script>
    window.prettyPrint();
</script>
</body>
</html>
